﻿using System.Web.Mvc;

namespace Infrastructure.Mvc.SeedWork.ViewEngines
{
    public class ThemesRazorViewEngine : RazorViewEngine
    {
        public ThemesRazorViewEngine()
        {
            //Area视图路径其中{2},{1},{0}分别代表Area名，Controller名，Action名  
            AreaViewLocationFormats = new[]
            {"~/Themes/{2}/{1}/{0}.cshtml", "~/Themes/Shared/{0}.cshtml", "~/Themes/{2}/Shared/{0}.cshtml"};
            //Area模版路径  
            AreaMasterLocationFormats = new[] {"~/Themes/Shared/{0}.cshtml"};

            //Area的分部视图路径  
            AreaPartialViewLocationFormats = new[]
            {
                "~/Themes/{2}/{1}/{0}.cshtml", "~/Themes/{2}/Shared/{0}.cshtml", "~/Themes/Shared/{0}.cshtml",
                "~/Themes/Shared/Control/{0}.cshtml"
            };
            //主视图路径  
            ViewLocationFormats = new[] {"~/Themes/{1}/{0}.cshtml", "~/Themes/Shared/{0}.cshtml"};
            //主模版路径  
            MasterLocationFormats = new[] {"~/Themes/Shared/{0}.cshtml"};
            //主分部视图路径  
            PartialViewLocationFormats = new[] {"~/Themes/{1}/{0}.cshtml", "~/Themes/Shared/{0}.cshtml"};
        }
    }
}